import React from 'react'
import { TabBar } from 'antd-mobile'
import {
    AppOutline,
    MessageOutline,
    UnorderedListOutline,
    UserOutline,
} from 'antd-mobile-icons'
import style from './css/index.module.css'
import { useNavigate } from 'react-router-dom'
function Tabbar() {
    const navigate = useNavigate()
    const tabs = [
        {
            key: '/index',
            title: '首页',
            icon: <AppOutline />,
        },
        {
            key: '/class',
            title: '待办',
            icon: <UnorderedListOutline />,
        },
        {
            key: '/user',
            title: '消息',
            icon: <MessageOutline />,
        },
        {
            key: '/my',
            title: '我的',
            icon: <UserOutline />,
        },
    ]

    const change = (key) => {
        navigate(key)
    }
    return (
        <div className={style.tab}>
            <TabBar onChange={change}>
                {tabs.map(item => (
                    <TabBar.Item key={item.key} icon={item.icon} title={item.title} />
                ))}
            </TabBar>
        </div>
    )
}

export default Tabbar
